<template>
  <simple-table
    :url-list="urlList"
    :current-use-btn-list="currentUseBtnList"
    :filed-property-list="filedPropertyList"
    submit-form-title="工厂维护"
    table-name="factory"
  ></simple-table>
</template>

<script lang="ts" setup>
import SimpleTable from "@/components/table/simple/SimpleTable.vue";
import { BtnNameEnum } from "@/components/table/simple/BtnNameEnum";
import { RuleEnum } from "@/components/form/basic/FormEnum";

const urlList = {
  refreshUrl: "/basic-request/Factory/search",
  modifyingSingleUrl: "/basic-request/Factory",
  modifyingBatchUrl: "/basic-request/Factory/batch",
  deleteUrl: "/basic-request/Factory/batch-delete",
};
// 当前页面使用的功能按钮
const currentUseBtnList: BtnNameEnum[] = [
  BtnNameEnum.ADD,
  BtnNameEnum.REFRESH,
  BtnNameEnum.DELETE,
  BtnNameEnum.BATCH_IMPORT,
  BtnNameEnum.BATCH_IMPORT_TEMPLATE,
];

const filedPropertyList = [
  {
    filedName: "id",
    label: "ID",
    width: 120,
    minWidth: 120,
    showInTable: false, // 该字段内容是否需要在表格中渲染显示.
    showInForm: false,
    formType: "el-form-text",
  },
  {
    filedName: "no",
    label: "工厂编号",
    span: 8,
    width: 180,
    minWidth: 180,
    showInTable: true, // 该字段内容是否需要在表格中渲染显示.
    showInForm: true,
    required: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "工厂编号不能为空",
      },
    ],
  },
  {
    filedName: "name",
    label: "工厂名称",
    span: 8,
    minWidth: 180,
    showInTable: true, // 该字段内容是否需要在表格中渲染显示.
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "工厂名称不能为空",
      },
    ],
  },
  {
    filedName: "phoneNumber",
    label: "联系方式",
    span: 8,
    minWidth: 180,
    showInTable: true, // 该字段内容是否需要在表格中渲染显示.
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "联系方式不能为空",
      },
    ],
  },
  {
    filedName: "address",
    label: "工厂地址",
    span: 8,
    minWidth: 180,
    showInTable: true, // 该字段内容是否需要在表格中渲染显示.
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "工厂地址不能为空",
      },
    ],
  },
  {
    filedName: "legalPerson",
    label: "法人",
    span: 8,
    minWidth: 180,
    showInTable: true, // 该字段内容是否需要在表格中渲染显示.
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "法人不能为空",
      },
    ],
  },
  {
    filedName: "zipCode",
    label: "邮编",
    span: 8,
    minWidth: 180,
    showInTable: true, // 该字段内容是否需要在表格中渲染显示.
    showInForm: true,
    formType: "el-form-text",
    rules: [
      {
        ruleName: RuleEnum.REQUIRED,
        ruleValue: true,
        message: "邮编不能为空",
      },
    ],
  },
  {
    filedName: "remark",
    label: "备注",
    minWidth: 180,
    showInTable: true, // 该字段内容是否需要在表格中渲染显示.
    showInForm: true,
    formType: "el-form-area-text",
  },
  {
    filedName: "createUser",
    label: "创建人",
    minWidth: 220,
    showInTable: true,
    showInForm: false,
    formType: "el-form-text",
  },
  {
    filedName: "createGmt",
    label: "创建时间",
    minWidth: 230,
    showInTable: true,
    showInForm: false,
    formType: "el-form-picker-date",
  },
  {
    filedName: "modifiedUser",
    label: "修改人",
    minWidth: 220,
    showInTable: true,
    showInForm: false,
    formType: "el-form-text",
  },
  {
    filedName: "modifiedGmt",
    label: "修改时间",
    minWidth: 230,
    showInTable: true,
    showInForm: false,
    formType: "el-form-picker-date",
  },
];
</script>

<style scoped></style>
